React Hooksを集めたlibraryなど
良い感じのReact Hooks
↓こういうまとめ方してもいざ必要な時に思い出せないんだよな...mrsekut.icon
一覧系のページ、だいたい存在を忘れる
リファレンス
react-hookz
react-use
the-platform
awesome-react-hooks
usehooks.com
Collection of React Hooks
検索しやすい、見やすい
ahooks
react-adaptive-hooks
GoogleChromeLabs製
ブラウザ用のhooks
ブラウザから回線速度などを取得など
https://github.com/alibaba/hooks
https://github.com/devjmetivier/hookit
https://beautifulinteractions.github.io/beautiful-react-hooks/#/Introduction
個人
個人的に便利だと思ったReact hooks 一覧 - Qiita
useFetchApi
ref, blog
コンポーネントのマウント時にApiを叩く
https://qiita.com/takeyuichi/items/41776005061f1697d67d
https://qiita.com/advent-calendar/2018/react-hooks-ogiri
https://github.com/jaredpalmer/the-platform
https://codesandbox.io/react-hooks
https://qiita.com/advent-calendar/2018/react-hooks-ogiri
大喜利
https://github.com/dai-shi/react-hooks-async
非同期処理系
まとめ記事
https://blog.bitsrc.io/10-react-custom-hooks-you-should-have-in-your-toolbox-aa27d3f5564d
https://qiita.com/takeyuichi/items/41776005061f1697d67d
usePrevious
https://usehooks.com/usePrevious/
前回のpropsを取得する
code:ts
export const usePrevious = <T>(value: T): undefined | T => {
const ref = useRef<T>();
useEffect(() => {
ref.current = value;
}, value);
return ref.current;
};
useDidUpdateEffect
https://stackoverflow.com/a/53180013
useEffectの初回に実行しない版
interfaceはuseEffectと全く同じ
useEffectReducer
https://github.com/davidkpiano/useEffectReducer
探し方
上述したリファレンスなどから探す
始めたての言語の関数に対するような感覚を抱くので、やっぱり使うものから使わないものまで、こんなのあるんだ〜って感じでざっと目を通しておくと良さそう